/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 * Description: op operator.
 * Author: qingjicheng
 * Create: 2022-11-28
 */

#ifndef HCCL_OPERATOR_H
#define HCCL_OPERATOR_H

#include <queue>
#include <map>
#include <memory>
#include <functional>
#include <vector>
#include "op_task.h"
#include "operator_param_type.h"

namespace hccl {
using HcclOpPtr = void *;
using TaskInfoPtr = void *;

template <typename ParamType>
class HcclOperator {
public:
friend class OpExecutor;

public:
    explicit HcclOperator() = default;
    explicit HcclOperator(ParamType &param) : param_(param)
    {
    }
    virtual ~HcclOperator() = default;
    void PushTask(OpTaskPtr &&opTask)
    {
        taskQue_.push(std::forward<OpTaskPtr &&>(opTask));
    }
    void Clear()
    {
        while (!taskQue_.empty()) {
            taskQue_.pop();
        }
    }

    // 需要默认初始化
    ParamType param_{};
    std::vector<u32> ranks_{};

private:
    std::queue<OpTaskPtr> taskQue_;
};

}
#endif
